<%- include('layouts/admin_header',{tittle:'Posts'})%>

<body>
  <script>
    NProgress.start();
  </script>

  <div class="main">
    <%- include('layouts/admin_navbar')%>
    <div class="container-fluid">
      <div class="page-title">
        <h1>所有文章</h1>
        <a href="post-add.html" class="btn btn-primary btn-xs">写文章</a>
      </div>
      <!-- 有错误信息时展示 -->
      <!-- <div class="alert alert-danger">
        <strong>错误！</strong>发生XXX错误
      </div> -->
      <div class="page-action">
        <!-- show when multiple checked -->
        <a
          class="btn btn-danger btn-sm"
          href="javascript:;"
          style="display: none"
          >批量删除</a
        >
        <form class="form-inline">
          <select name="" class="form-control input-sm">
            <option value="">所有分类</option>
            <option value="">未分类</option>
          </select>
          <select name="" class="form-control input-sm">
            <option value="">所有状态</option>
            <option value="">草稿</option>
            <option value="">已发布</option>
          </select>
          <button class="btn btn-default btn-sm">筛选</button>
        </form>
        <ul class="pagination pagination-sm pull-right">
          <li><a href="#">上一页</a></li>
          <li><a href="#">1</a></li>
          <li><a href="#">2</a></li>
          <li><a href="#">3</a></li>
          <li><a href="#">下一页</a></li>
        </ul>
      </div>
      <table class="table table-striped table-bordered table-hover">
        <thead>
          <tr>
            <th class="text-center" width="40"><input type="checkbox" /></th>
            <th>标题</th>
            <th>作者</th>
            <th>分类</th>
            <th class="text-center">发表时间</th>
            <th class="text-center">状态</th>
            <th class="text-center" width="100">操作</th>
          </tr>
        </thead>
        <tbody>
          <% for(var i = 0; i < arr.length; i++) { %>
          <tr data-id="<%=arr[i].id%>">
            <td class="text-center"><input type="checkbox" /></td>
            <td><%=arr[i].title%></td>
            <td><%=arr[i].nickname%></td>
            <td><%=arr[i].name%></td>
            <td class="text-center"><%=arr[i].created%></td>
            <td class="text-center">
              <% if(arr[i].status == 'drafted') {%> 草稿 <% } else
              if(arr[i].status == 'published') { %> 已发布 <% } else
              if(arr[i].status == 'trashed') { %> 已作废 <% } %>
            </td>
            <td class="text-center">
              <a href="javascript:;" class="btn btn-default btn-xs">编辑</a>
              <a href="javascript:;" class="btn btn-danger btn-xs">删除</a>
            </td>
          </tr>
          <% } %>
        </tbody>
      </table>
    </div>
  </div>

  <%- include('layouts/admin_aside'); %> <%- include('layouts/admin_footer'); %>
</body>
